﻿<views:MvxPhonePage
    x:Class="Bulb.UI.WindowsPhone.Views.DetailBulbView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:views="clr-namespace:Cirrious.MvvmCross.WindowsPhone.Views;assembly=Cirrious.MvvmCross.WindowsPhone"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:commandbinding="clr-namespace:Cirrious.MvvmCross.WindowsPhone.Commands;assembly=Cirrious.MvvmCross.WindowsPhone"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="True">

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock Text="{StaticResource ApplicationName}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock Text="{Binding Item.Name, FallbackValue=Name}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <StackPanel>
                <TextBlock Text="{Binding Item.Description, FallbackValue=Description}" TextWrapping="Wrap" FontSize="{StaticResource PhoneFontSizeMedium}"></TextBlock>
                <toolkit:ToggleSwitch IsChecked="{Binding Item.State, Mode=TwoWay}">

                    <interactivity:Interaction.Triggers>
                        <interactivity:EventTrigger EventName="Checked">
                            <commandbinding:MvxEventToCommand Command="{Binding OnCommand}"/>
                        </interactivity:EventTrigger>
                        <interactivity:EventTrigger EventName="Unchecked">
                            <commandbinding:MvxEventToCommand Command="{Binding OffCommand}"/>
                        </interactivity:EventTrigger>
                    </interactivity:Interaction.Triggers>

                </toolkit:ToggleSwitch>

                <Image Width="300" Height="300" Source="{Binding Item.ImagePath, Converter={StaticResource FilePathToImage}}"></Image>
                
                <!--<Button Content="{Binding TextSource, Converter={StaticResource Language}, ConverterParameter=History, FallbackValue=History, Mode=OneTime}" Command="{Binding HistoryCommand}"></Button>-->
            </StackPanel>
        </Grid>
    </Grid>

    <views:MvxPhonePage.ApplicationBar>
        <shell:ApplicationBar>
            <shell:ApplicationBar.Buttons>
                <shell:ApplicationBarIconButton IconUri="/Toolkit.Content/ApplicationBar.Edit.png" Text="Edit" Click="ApplicationBarIconButtonEdit_OnClick" />
                <shell:ApplicationBarIconButton IconUri="/Toolkit.Content/ApplicationBar.Delete.png" Text="Delete" Click="ApplicationBarIconButtonDelete_OnClick" />
            </shell:ApplicationBar.Buttons>
        </shell:ApplicationBar>
    </views:MvxPhonePage.ApplicationBar>
    
</views:MvxPhonePage>